package com.smedi.ismedi.authoritymanagement.api.feign;

import com.smedi.ismedi.authoritymanagement.api.dto.request.ChangeMobileRequest;
import com.smedi.ismedi.authoritymanagement.api.dto.request.ChangePasswordRequest;
import com.smedi.ismedi.authoritymanagement.api.dto.request.CreateAccountBasicRequest;
import com.smedi.ismedi.authoritymanagement.api.dto.request.ForgetPasswordRequest;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"用户密码管理接口"})
@FeignClient(name = "ismedi-authority-management")
@RequestMapping(value = "/api/v1/account/management")
public interface RemoteAccountManagementFeignApi {
    /**
     * 创建用户信息
     *
     * @param createAccountBasicRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "创建用户信息")
    @PostMapping(value = "/createAccount")
    ResponseData<String> postCreateAccount(@Validated @RequestBody CreateAccountBasicRequest createAccountBasicRequest);

    /**
     * 更新用户登录密码
     *
     * @param changePasswordRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "更新用户登录密码")
    @PostMapping(value = "/changePassword")
    ResponseData<Boolean> postChangePassword(@Validated @RequestBody ChangePasswordRequest changePasswordRequest);

    /**
     * 更新用户登录手机号
     *
     * @param changeMobileRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "更新用户登录手机号")
    @PostMapping(value = "/changeMobile")
    ResponseData<Boolean> postChangeMobile(@Validated @RequestBody ChangeMobileRequest changeMobileRequest);

    // todo 设置短信发送限制
    /**
     * 获取验证码
     *
     * @param forgetPasswordRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "获取验证码")
    @PostMapping(value = "/generateVerificationCode")
    ResponseData<Boolean> postSendVerificationCode(@Validated @RequestBody ForgetPasswordRequest forgetPasswordRequest);

    /**
     * 提交验证码
     *
     * @param forgetPasswordRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "提交验证码")
    @PostMapping(value = "/submitVerificationCode")
    ResponseData<Boolean> postSubmitVerificationCode(@Validated @RequestBody ForgetPasswordRequest forgetPasswordRequest);

    /**
     * 重置密码
     *
     * @param forgetPasswordRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "重置密码")
    @PostMapping(value = "/resetPassword")
    ResponseData<Boolean> postResetPassword(@Validated @RequestBody ForgetPasswordRequest forgetPasswordRequest);

    /**
     * 启用用户
     *
     * @param personId
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "开启用户")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personId", value = "人员id", dataType = "Long", dataTypeClass = Long.class)
    })
    @PutMapping(value = "/enable")
    ResponseData<Boolean> putEnable(@RequestParam("personId") Long personId);

    /**
     * 关闭用户
     *
     * @param personId
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "关闭用户")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personId", value = "人员id", dataType = "Long", dataTypeClass = Long.class)
    })
    @PostMapping(value = "/disable")
    ResponseData<Boolean> putDisable(@RequestParam("personId") Long personId);

    /**
     * 删除用户信息
     *
     * @param personId
     * @return
     */
    @ApiOperation(httpMethod = "DELETE", value = "删除用户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personId", value = "人员id", dataType = "Long", dataTypeClass = Long.class)
    })
    @DeleteMapping(value = "/deleteAccount")
    ResponseData<Boolean> deleteAccount(@RequestParam("personId") Long personId);

    /**
     * 仅删除用户信息
     *
     * @param personId
     * @return
     */
    @ApiOperation(httpMethod = "DELETE", value = "仅删除用户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personId", value = "人员id", dataType = "Long", dataTypeClass = Long.class)
    })
    @DeleteMapping(value = "/deleteAccountOnly")
    ResponseData<Boolean> deleteAccountOnly(@RequestParam("personId") Long personId);
}
